/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package navigator;

import MVC.IModel;
import com.teamdev.jxbrowser.Browser;
import technical.ClInit;

/**
 * @author Michael
 */
public class NavigatorModel implements IModel {

    //private ArrayList<PageModel> _pages;
    private Browser _pages[];
    private static int __maxTab = ClInit.getBrowserMaxTabNumber();

    /*
     * Constructor
     */
    public NavigatorModel() {
        _pages = new Browser[__maxTab];
    }

    /**
     * @return the _pages
     */
    public Browser[] getPages() {
        return _pages;
    }

    /**
     * @param pages the _pages to set
     */
    public void setPages(Browser[] pages) {
        this._pages = pages;
    }

    /*
     * @return a page
     */
    public Browser getPage(String url) {
        
        Browser p = null;
        for (Browser pageModel : _pages) {
            if (pageModel.getCurrentLocation().equalsIgnoreCase(url) || pageModel.getCurrentLocation().concat("/").equalsIgnoreCase(url)) {
                p = pageModel;
            }
        }

        return p;
    }
}
